package com.thermoberg.passport.service.impl;

import com.thermoberg.passport.dao.SbyPassportDao;
import com.thermoberg.passport.entity.SbyPassport;
import com.thermoberg.passport.service.SbyPassportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by wanghe on 2016/11/3.
 */
@Service
public class SbyPassportServiceImpl implements SbyPassportService {
    @Autowired
    private SbyPassportDao sbyPassportDao;

    @Override
    public SbyPassport loginuser(String username, String password, String chat) {
        if(chat == ""){
            return sbyPassportDao.loginuser(username,password);
        }
        if(chat.equals("backstagetoken")){
            return sbyPassportDao.backstageloginuser(username,password);
        }
        if(chat.equals("optimizetoken")){
            return sbyPassportDao.optimizeloginuser(username,password);
        }
        return null;
    }

    @Override
    public List<SbyPassport> sbyPassportList() {
        return sbyPassportDao.sbyPassportList();
    }

    @Override
    public SbyPassport sbyPassportList(Integer id) {
        return sbyPassportDao.sbyPassportList(id);
    }

    @Override
    public SbyPassport querypwd(Integer id, String password) {
        return sbyPassportDao.querypwd(id, password);
    }

    @Override
    public Integer resetPwd(Integer id) {
        return sbyPassportDao.resetPwd(id);
    }

    @Override
    public Integer updatepwd(Integer id, String password) {
        return sbyPassportDao.updatepwd(id, password);
    }

    @Override
    public Integer insertuser(SbyPassport sbyPassport) {
        return sbyPassportDao.insertuser(sbyPassport);
    }

    @Override
    public Integer updateuser(SbyPassport sbyPassport, Integer id) {
        return sbyPassportDao.updateuser(sbyPassport, id);
    }

    @Override
    public Integer deleteuser(Integer id) {
        return sbyPassportDao.deleteuser(id);
    }
}
